class Event < ActiveRecord::Base
  attr_accessible :deadline, :description, :end_date, :image_path, :location, :registration_link, :start_date, :title, :type, :photo

	has_attached_file :photo,
                    :url  => "/assets/events/:id/:style/:basename.:extension",
                    :path => ":rails_root/public/assets/events/:id/:style/:basename.:extension"

  validates_attachment_size :photo, :less_than => 5.megabytes
  validates_attachment_content_type :photo, :content_type => ['image/jpeg', 'image/png']

	validates :title, :length   => { :maximum => 50 }, :presence => true
	validates :start_date, :presence => true
	validates :end_date, :presence => true
	validates :description, :presence => true
	validates :photo, :presence => true
	
end
